//Sun 07 Feb 2010 12:08:51 PM CST 
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;
//Given that x * y = z, there are three possible cases that all triplets can be split to, disjointly:
//x = y = sqrt(z)
//x < sqrt(z), and thus y > sqrt(z)
//x > sqrt(z), and thus y < sqrt(z)


class ProductTriplet
{
public:
	long long countTriplets(int minx, int maxx, int miny, int maxy, int minz, int maxz)
	{
//		long long minx = x1;
//		long long maxx = x2;
//		long long miny = y1;
//		long long maxy = y2;
//		long long minz = z1;
//		long long maxz = z2;
		long long ret = 0;
		for(int a=minx; a<=maxx && (long long)a*a<=maxz; ++a)
		{
			long long up = min(maxz/a, maxy);
			long long low = max(a, max(miny-1, (minz-1)/a));
			if(up > low) ret += (up - low);
		}

		for(int b=miny; b<=maxy && (long long)b*b<=maxz; ++b)
		{
			long long up = min(maxz/b, maxx);
			long long low = max(b, max(minx-1, (minz-1)/b));
			if(up > low) ret += (up - low);
		}

		for(int i=max(minx, miny); i<=min(maxx, maxy) && (long long)i*i<=maxz; ++i)
		{
			long long k = (long long)i * i;
			if(k >= minz && k <= maxz) ret++;
		}
		return ret;
	}
};
